﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Fitness.Data;
using Windows.UI.Xaml.Controls;

namespace Fitness.VariableTemplate
{
   public class VariableTileControl : GridView
    {

    protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
       {
           if (item.GetType() == typeof(HubPageDataItem))
           {
               
           var viewModel = item as HubPageDataItem;
           element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty,viewModel.ColSpan);
           element.SetValue(VariableSizedWrapGrid.RowSpanProperty, viewModel.RowSpan);
           base.PrepareContainerForItemOverride(element, item);
           }

           else if (item.GetType() == typeof(RecipesPageDataItem))
           {

               var viewModel = item as RecipesPageDataItem;
               element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, viewModel.ColSpan);
               element.SetValue(VariableSizedWrapGrid.RowSpanProperty, viewModel.RowSpan);
               base.PrepareContainerForItemOverride(element, item);
           }
       }

    }
}


